package com.example.demo.service.lxy;

import com.example.demo.dao.lxy.RoleDao;
import com.example.demo.entity.Role;
import com.example.demo.entity.User;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired(required = true)
    RoleDao roleDao;
    @Override
    public List<Role> findall() {
        List<Role> roleList= roleDao.findall();
        return roleList;
    }

    @Override
    public List<Role> findByName(String name) {
        List<Role> roleList= roleDao.findByName(name);
        return roleList;
    }

//    @Override
//    public List<Role> AddRole(String name) {
//        String nametemp=name;
//        int role = roleDao.AddRole(nametemp);
//        if(role>=1){
//            List<Role> roleListAfterInsert= roleDao.findall();
//            return roleListAfterInsert;
//        } else {
//            System.out.println("error insert");
//            return null;
//        }
//    }
}
